package com.example.hotel_demo.mapper;

import com.example.hotel_demo.pojo.RoomCommodity;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface RoomCommodityMapper {
    //<a href="">管理员客房商品管理</a>
    // <a href="">管理员修改客房商品信息</a>  <a href="">管理员添加客房商品信息</a> <br> RoomCommodity
    @Select("select * from roomcommodity ")
    public List<RoomCommodity> getRoomCommAll();

    @Select("select * from roomcommodity where roomID =#{roomID}")
    public List<RoomCommodity> getRoomCommByRoomID(int roomID);

    @Update("update roomcommodity set commName = #{commName} where  roomID =#{roomID}")
    public int updateRoomCommodityNameByRoomID(String commName, int roomID);

    @Update("update roomcommodity set commName = #{commName} , commPrice = #{commPrice} ,commNum = #{commNum}  where  roomID =#{roomID}")
    public int updateRoomCommodityByRoomID(String commName, int commPrice, int commNum, int roomID);

    @Insert("insert into roomcommodity (roomID,commName,commPrice,commNum) values (#{roomID},#{commName},#{commPrice},#{commNum})")
    public int addRoomCommodity(String commName, int commPrice, int commNum, int roomID);

    @Delete("delete from roomcommodity where roomID = #{roomID} and commName = #{commName}")
    public int deleteCommodityByRoomIDAndCommName(int roomID,String commName);

}
